(deffunction isvv
(?cve ?oid)
(bind ?x " { \"cve\" : \"")    
(bind ?x (str-cat ?x ?cve))
(bind ?x (str-cat ?x "\", \"result._id\":ObjectId(\""))
(bind ?x (str-cat ?x ?oid))
(bind ?x (str-cat ?x "\")}"))
(bind ?return-value (dbcount "localhost" "test.cve" ?x))
(return ?return-value)
)

(defrule is-valid-vulnerability
(cve ?cve)
(result._id ?oid)
(test (> (isvv ?cve ?oid) 0))
=>
(alert valid-vulnerability)
)
